home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / bipl.zip / IDOL.ZIP / OS2.ICN < prev    next >
Text File  |  1991-12-30  |  2KB  |  91 lines

  1. #
  2. # @(#)os2.icn    1.5 5/5/90
  3. # OS-specific code for OS/2 Idol
  4. # Adapted from msdos.icn by cheyenne wills
  5. #
  6. global icontopt,cd,md,env,sysok
  7.  
  8. procedure mysystem(s)
  9.   if \loud then write(s)
  10.   return system(s)
  11. end
  12.  
  13. procedure filename(s,ext)
  14.   s[9:0] := ""
  15.   s ||:= \ext
  16.   return s
  17. end
  18. # if the filename s has extension ext then return the filename less the
  19. # extension, otherwise fail.
  20. procedure fileroot(s,ext)
  21.   if s[- *ext : 0] == ext then return s[1 : - *ext]
  22. end
  23. procedure writesublink(s)
  24.   writelink(env||"\\\\"||s)
  25. end
  26. procedure envpath(filename)
  27.   return env||"\\"||filename
  28. end
  29. #
  30. # Installation.
  31. # Uses hierarchical filesystem on some systems (see initialize)
  32. #
  33. procedure install(args)
  34.   write("Installing idol environment in ",env)
  35.   if env ~== "" then mysystem(md||env)
  36.   fout := envopen("i_object.icn","w")
  37.   write(fout,"record idol_object(__state,__methods)")
  38.   close(fout)
  39.   fout := &null
  40.   cdicont(["i_object"])
  41. end
  42. procedure uninstall(args)
  43.   # not implemented yet
  44. end
  45.  
  46. procedure makeexe(args,i)
  47.   exe := args[i]
  48.   if icont(exe) = \sysok then {
  49.       mysystem((if find("UNIX",&features) then "rm " else "del ")||exe||".icn")
  50.       if \exec then {
  51.     write("Executing:")
  52.     if not find("UNIX",&features) then exe := "iconx "||exe
  53.     every i := exec+1 to *args do exe ||:= " "||args[i]
  54.     mysystem(exe)
  55.       }
  56.   }
  57. end
  58. #
  59. # system-dependent compilation of idolfile.icn
  60. #   (in the idol subdirectory, if there is one)
  61. #
  62. procedure cdicont(idolfiles)
  63. initial { s := (getenv("ICONT")|"icont") }
  64.  
  65.   if comp = -2 then return  # -t --> don't call icont at all
  66.   args := " -c"
  67.   rms  := ""
  68.   every ifile := !idolfiles do args ||:= " " || ifile
  69.   every ifile := !idolfiles do rms  ||:= " " || ifile || ".icn"
  70.   cdcmd := open("idolenv.cmd","w")
  71.   write(cdcmd,"@echo off")
  72.   write(cdcmd,"cd idolcode.env")
  73.   write(cdcmd,s,args)
  74.   write(cdcmd,"if errorlevel 1 goto xit")
  75.   every ifile := !idolfiles do
  76.     write(cdcmd,"del ",ifile,".icn")
  77.   write(cdcmd,":xit")
  78.   write(cdcmd,"cd ..")
  79.   close(cdcmd)
  80.   mysystem("idolenv.cmd")
  81.   mysystem("del idolenv.cmd")
  82.   return
  83. end
  84. procedure sysinitialize()
  85.   icontopt := " -Sr500 -SF30 -Si1000 "
  86.   cd := "cd "
  87.   md := "mkdir "
  88.   env := getenv("IDOLENV") | "idolcode.env"
  89.   sysok := 0
  90. end
  91.